﻿Ext.extend(demo.module,{
    init: function(){
      var pageParams={start:0,limit:20};
 	  var opt={ 
	  url:'sizequery'	  
	  };  	
	  opt.fields=[
	  {name:'id',text:'id',header:{hidden:true},ft:'hidden'}, 	  
	  {name:'size',text:'size',ft:{allowBlank:false}},	
	  {name:'seq',text:'序列',ft:{xtype:'numberfield',allowBlank:false,allowNegative:false,allowDecimals:false}}	
	  ];	  
	  opt.gridConfig={};	
	  opt.gridConfig.tbar=[
	   {text:'添加',iconCls:'add',handler:function(x){
	     this.window.setTitle(x);
	     this.window.show();
	   }},
	   {
	     text:'修改',iconCls:'edit',handler:function(x)
	     {
	       this.window.setTitle(x);
		   this.edit();
	     }
	   }	   
	  ];  // end tbar
	  
	  
     opt.gridConfig.bbar={pageSize:pageParams.limit};     
	 var g=new Ext.fay.ui.CURDGrid(opt);
	 g.on("save",function(values){
	    if(this.isValid())
	    {
	      this.postJson({
	       url:'savesize',
	       params:{size:values}
	      })
	    }
	 });  
	 this.main.add(g.grid);
     this.main.doLayout();   
      g.ds.reload({params:pageParams});
   }
});